package com.ld.security.server.blog.modules.da.service.impl;


import com.ld.security.server.blog.modules.da.entity.DaHtmlTelEntity;
import com.ld.security.server.blog.modules.da.service.IDaHtmlTelService;
import com.ld.security.common.mybatis.base.po.IdsPo;
import com.ld.security.common.mybatis.base.service.*;
import com.ld.security.server.blog.modules.da.service.IDaHtmlService;

import com.ld.security.server.blog.modules.da.entity.DaHtmlEntity;

import com.ld.security.server.blog.modules.da.service.IDaHtmlService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class DaHtmlServiceImpl  extends ISuperServiceImpl<DaHtmlEntity>
implements
        IDaHtmlService {

        @Autowired
        IDaHtmlTelService iDaHtmlTelService;


        @Override
        public int save(DaHtmlEntity entity) {
                //不存在初始化
                if(!this.hasEntity(entity.getId())){
                        DaHtmlTelEntity htmlTelEntity =  iDaHtmlTelService.getById(entity.getHtmlTelId());
                        entity.setConfig(htmlTelEntity.getConfig());
                }

                return super.save(entity);
        }
}
